/*
 * Copyright (c) 2018. QDU 2015 Java1 Team CompilationError
 */

$(document).ready(function () {
	$("#new_dsgn_form").submit(function () {

		$("#new_dsgn_form").ajaxSubmit({
			url: "new_designation",
			target: null,
			type: "post",
			dataType: "json",
			success: function (data) {
				if (data.status == "success") {
					showMessagePopup("Success", "Designation Created.",
						function () {
							window.location = "modify_designation?dsgnId=" + data.id;
						});
				} else {
					showErrorPopup("Error", data.error);
				}
			},

			error: function (jqHXR, textStatus, error) {
				showErrorPopup("Error", "Could not connect to server");
			}
		});

		return false;
	});

});